package com.neo.blog.controller;

import java.util.List;

import javax.jws.soap.SOAPBinding.Use;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;



import com.neo.blog.entity.User;
import com.neo.blog.mapper.UserMapper;

@Controller 
public class HomeController {

	@Autowired
	UserMapper userMapper;

	@RequestMapping(value = "/home2")
	public String home() {
		System.out.println("redirect to home page!");
		return "home";
	}

	@RequestMapping(value = "index")

	public String goHome(Model model) {

		List<User> users = userMapper.findAll();
		model.addAttribute("users", users);

		return "user/list";
	}

}
